/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * HistorySearchForm.java
 *
 * Created on 07/12/2009, 14:07:01
 */

package sigbar.view;

/**
 *
 * @author Denis
 */
public class HistorySearchForm extends javax.swing.JPanel {

    /** Creates new form HistorySearchForm */
    public HistorySearchForm() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {
        java.awt.GridBagConstraints gridBagConstraints;

        titleLabel = new javax.swing.JLabel();
        date = new javax.swing.JFormattedTextField();
        historyPane = new javax.swing.JScrollPane();
        history = new javax.swing.JTable();
        submit = new javax.swing.JButton();
        gambi = new javax.swing.JLabel();
        totalLabel = new javax.swing.JLabel();

        setLayout(new java.awt.GridBagLayout());

        titleLabel.setText("Digite a Data:");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
        add(titleLabel, gridBagConstraints);

        date.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.DateFormatter()));
        date.setMinimumSize(new java.awt.Dimension(100, 20));
        date.setPreferredSize(new java.awt.Dimension(100, 20));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
        gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
        add(date, gridBagConstraints);

        historyPane.setMinimumSize(new java.awt.Dimension(775, 160));
        historyPane.setPreferredSize(new java.awt.Dimension(775, 160));

        history.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null}
            },
            new String [] {
                "Nome", "Alteração de Estoque", "Valor (Unidade)"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                false, false, false
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        history.setPreferredSize(new java.awt.Dimension(600, 140));
        history.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                historyMouseEntered(evt);
            }
        });
        historyPane.setViewportView(history);
        history.getColumnModel().getColumn(0).setResizable(false);
        history.getColumnModel().getColumn(1).setResizable(false);
        history.getColumnModel().getColumn(2).setResizable(false);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.gridwidth = 4;
        gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
        add(historyPane, gridBagConstraints);

        submit.setText("Buscar");
        submit.setMinimumSize(new java.awt.Dimension(55, 55));
        submit.setPreferredSize(new java.awt.Dimension(55, 55));
        submit.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                submitMouseEntered(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 2;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.gridheight = 2;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
        add(submit, gridBagConstraints);

        gambi.setMinimumSize(new java.awt.Dimension(300, 60));
        gambi.setPreferredSize(new java.awt.Dimension(300, 60));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.gridheight = 2;
        add(gambi, gridBagConstraints);

        totalLabel.setText("Total:");
        totalLabel.setEnabled(false);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 3;
        gridBagConstraints.gridwidth = 4;
        gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
        add(totalLabel, gridBagConstraints);
    }// </editor-fold>//GEN-END:initComponents

    private void submitMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_submitMouseEntered
        GerenteForm ger = (GerenteForm) getParent().getParent();
        ger.setHelpText("Exibe o histórico da data informada.");
    }//GEN-LAST:event_submitMouseEntered

    private void historyMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_historyMouseEntered
        GerenteForm ger = (GerenteForm) getParent().getParent();
        ger.setHelpText("<html>Nome: O nome do produto.<br>Alteração de Estoque: O número que representa a mudança do estoque de um produto.<br>Valor (Unidade): O preço do produto.</html>");
    }//GEN-LAST:event_historyMouseEntered


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JFormattedTextField date;
    private javax.swing.JLabel gambi;
    private javax.swing.JTable history;
    private javax.swing.JScrollPane historyPane;
    private javax.swing.JButton submit;
    private javax.swing.JLabel titleLabel;
    private javax.swing.JLabel totalLabel;
    // End of variables declaration//GEN-END:variables

}
